package c.j.a.c.q;

import android.os.Build.VERSION;
import c.j.a.d.b.n.d0;
import java.lang.reflect.Field;
import java.lang.reflect.Proxy;

/* compiled from: AntiHijackUtils */
public final class a implements Runnable {
    public void run() {
        d0.g();
        try {
            Field declaredField;
            if (VERSION.SDK_INT < 26) {
                declaredField = Class.forName("android.app.ActivityManagerNative").getDeclaredField("gDefault");
            } else {
                declaredField = Class.forName("android.app.ActivityManager").getDeclaredField("IActivityManagerSingleton");
            }
            declaredField.setAccessible(true);
            Object obj = declaredField.get(null);
            Field declaredField2 = Class.forName("android.util.Singleton").getDeclaredField("mInstance");
            declaredField2.setAccessible(true);
            Object obj2 = declaredField2.get(obj);
            if (obj2 != null) {
                Class cls = Class.forName("android.app.IActivityManager");
                b bVar = new b(obj2, null);
                declaredField2.set(obj, Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]{cls}, bVar));
            }
        } catch (Throwable unused) {
        }
    }
}
